package com.yxdj.service.api;

import com.yxdj.common.core.constant.SecurityConstants;
import com.yxdj.common.core.constant.ServiceNameConstants;
import com.yxdj.common.core.domain.R;
import com.yxdj.service.api.domain.MainCategory;
import com.yxdj.service.api.factory.RemoteMainCategoryFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;

@FeignClient(contextId = "remoteMainCategoryService",value = ServiceNameConstants.SERVICE_SERVICE,fallbackFactory = RemoteMainCategoryFallbackFactory.class)
public interface RemoteMainCategoryService {

    /**
     * 查询前几个主分类
     * @param limit
     * @param source
     * @return
     */
    @GetMapping("/main/app/getMainCategoryList/{limit}")
    R<List<MainCategory>> getMainCategoryList(@PathVariable(name = "limit") Integer limit, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 查询所有分类（包含子分类和服务项）
     * @param source
     * @return
     */
    @GetMapping("/main/app/getAllCategory")
    R<List<MainCategory>> getAllCategory(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
